
class UserGroup(object):
  """Association between User and Group.
  
  Attributes:
    - user
    - group
  """
  
  def __init__(self, user=None, group=None):
    """This is intended to be used by the associaton proxy of sqlalchemy.
    Either the attribute user or group is already set, the other one is provided.
    """
    if user is not None:
      assert group is None
      self.user = user
    elif group is not None:
      assert user is None
      self.group = group
      
  def __repr__(self):
    return "<User-Group association %s %s %s>" % \
            (self.id, self.user, self.group)
      